import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';
import 'dart:ui' as ui show window;

import '../constant/app_constant.dart';

class AppUtil {
  static void logout() {}

  /// 标题栏高度（包括状态栏）
  static double get navigationBarHeight {
    MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
    return mediaQuery.padding.top + kToolbarHeight;
  }

  /// 状态栏高度
  static double get topSafeHeight {
    MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
    return mediaQuery.padding.top;
  }

  /// 屏幕的高度，去掉标题栏
  static double get screenHeight {
    MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
    return mediaQuery.size.height - mediaQuery.padding.top - kToolbarHeight;
  }

  static bool isEmpty(String? data) {
    if (data == null || data == "" || data.isEmpty) {
      return true;
    }
    return false;
  }

  /// 获取版本信息
  static Future<String> getVersionCode() async {
    final PackageInfo info = await PackageInfo.fromPlatform();
    return info.version;
  }
}
